<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script language="javascript" src="/js/jquery-1.8.0.min.js"></script>
    <title>淘宝码商申请列表 - 票付通分销平台</title>
</head>
<body>
<link rel="stylesheet" href="/css/aliceui.min.css"/>
<link rel="stylesheet" href="/css/resetui.css"/>
<link rel="stylesheet" href="/css/page.css"/>
<link rel="stylesheet" href="css/list.css"/>
<link rel="stylesheet" href="//www.16u.com/manage/admin/css/dialog.css"/>
<div class="wrap">
    <form name="ourform" class="search_form ">
    <fieldset class="search-box">
        <legend>查询</legend>
        <table class="search-tbl" cellspacing="0">
            <tr>
                <td>
                    <label class="t">审核状态</label>
                    <select name="status">
                        <option value="-1" <?=!isset($_GET['status']) || $_GET['status']==-1? 'selected':'';?>>--不限--</option>
                        <option value="0" <?=isset($_GET['status']) && $_GET['status']==0? 'selected':'';?>>未审核</option>
                        <option value="1" <?=$_GET['status']==1? 'selected':'';?>>正常</option>
                        <option value="2" <?=$_GET['status']==2? 'selected':'';?>>拒绝</option>
                    </select>
                </td>
                <td>
                    <button id="searchBtn" type="submit" class="ui-button ui-button-lorange">查　找</button>
                </td>
            </tr>
        </table>
    </fieldset>
</form>
    <div class="ui-table-container">
        <table class="ui-table ui-table-noborder"><!-- 可以在class中加入ui-table-inbox或ui-table-noborder分别适应不同的情况 -->
        <thead>
        <tr>
            <th>申请时间</th>
            <th>卖家帐号</th>
            <th>企业名</th>
            <th>ID</th>
            <th>联系人</th>
            <th>手机</th>
            <th>审核状态</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody id="tao_list_tbd">
        <? foreach($mem_list as $list): ?>
        <tr id="tr_<?=$list['log_id']?>">
            <td><?=$list['creattime']?></td>
            <td><?=substr($list['data1'], strpos($list['data1'],'|')+1)?></td>
            <td><?=$LD[$list['dtype']].'|'.$list['dname']?></td>
            <td><?=$list['account']?></td>
            <td><?=$list['cname']?></td>
            <td><?=$list['mobile']?></td>
            <td class="status"><?=$LVS[$list['verify_status']]?></td>
            <td data-lid="<?=$list['log_id']?>" data-uid="<?=$list['uid']?>">
                <?if($list['verify_status']==0):?>
                    <a href="javascript:;" class="verify" data-status="1">通过</a>
                    <a href="javascript:;" class="refuse" data-status="2">拒绝</a>
                <?elseif($list['verify_status']==1):?>
                    <a href="javascript:;" class="verify" data-status="3">解除绑定</a>
                <?else:?>

                <?endif;?>
            </td>
        </tr>
        <? endforeach; ?>
        </tbody>
    </table>
        <?page($total_rows,$currentPage,$pageSize);?>
    </div>
</div>
<div id="refuseDialog" class="dialog">
    <h3>请输入拒绝理由</h3>
    <p class="L">
        <input name="did" type="hidden"/>
        <input name="lid" type="hidden"/>
        <textarea class="textarea" name="refuseReason" id="refuseReason"></textarea>
    </p>
    <p class="border-top">
        <button type="button" id="cancel">取消</button>
        <button type="button" id="submit">确定</button>
    </p>
</div>
<script type="text/javascript" src="/js/Calendar.js"></script>
<script type="text/javascript" src="/js/moment.min.js"></script>
<script type="text/javascript" src="/js/d.js"></script>
<script type="text/javascript" src="/js/easydialog.min.js"></script>
<script type="text/javascript">
    $(function(){
        $("tbody").on('dblclick','td', function(){
            if($(this).hasClass('td_dname')) {
                $(this).find('input.dname_input')
                        .removeAttr('readonly')
                        .addClass('edit_dname')
                        .focus();
                return;
            }
            var tr = $(this).parent('tr');
            if(tr.hasClass('hightlight')) {
                tr.removeClass('hightlight');
            } else {
                tr.addClass('hightlight');
            }

        });
        $("#tao_list_tbd").on('click', 'a.refuse', function() {
            var father = $(this).parent();
            $("input[name='did']").val(father.attr('data-uid'));
            $("input[name='lid']").val(father.attr('data-lid'));
            easyDialog.open({
                container : 'refuseDialog',
                fixed : true
            });
        });
        $("#cancel").on('click',function(){
            $("input[name='did']").val(0);
            $("input[name='lid']").val(0);
            easyDialog.close();
        });
        $("#submit").on('click', function(){
            var reason = $("#refuseReason").val(),
                log_id = $("input[name='lid']").val(),
                uid = $("input[name='did']").val();
            if(!reason) {
                alert('请输入拒绝的理由，谢谢');
                return false;
            }
            $.post('/call/jh_mem.php', {action:'ApplyVerify',uid: uid,
                log_id:log_id, status:2, dtype:2, msg: reason})
                .done(function(res){
                    if(res['status']=='ok') {
                        alert('已拒绝');
                        $("tr#tr_"+log_id).remove();
                    }
                });
            easyDialog.close();
        })
        $("#tao_list_tbd").on('click', 'a.verify', function(){
            var status = $(this).attr('data-status'),
                parent_obj = $(this).parent('td'),
                log_id = parent_obj.attr('data-lid'),
                uid = parent_obj.attr('data-uid'),
                params = {action:'ApplyVerify', uid: uid, status:status, dtype:2, log_id:log_id},
                msg = ['',
                    '您确定该分销商的淘宝账号已经绑定到“票付通”账号？',
                    '您确定拒绝该淘宝账号与“票付通”账号进行绑定吗？',
                    '您确定该分销商的淘宝账号与“票付通”账号已取消绑定吗？'
                ];
            if(!confirm(msg[status])){
                return false;
            }
            $.post("/call/jh_mem.php", params, function(res){
                //alert(res.msg);
                if(res.status=='ok') {
                    $("tr#tr_"+log_id).remove();
                }
            },'json');
        });
    });
</script>
</body>
</html>
